// process.nextTick和promise.then会阻塞事件循环的有序进行
const fs = require('fs')
process.nextTick(() => {
    console.log('process执行');
    // let d = +new Date()
    // while(+new Date() < d + 3000) {

    // }
})
Promise.resolve().then(() => {
    console.log('promise执行');
    let d = +new Date()
    while(+new Date() < d + 3000) {

    }
    Promise.resolve().then(() => {
        console.log('111');
    })
})
fs.readFile('./node事件循环.js', () => {
    console.log('IO, file');
})
setTimeout(() => {
    console.log('timeout1');
    process.nextTick(() => {
        console.log('timeout1的tick');
    })
}, 0)
setTimeout(() => {
    console.log('timeout2');
}, 3000)